<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<title>报表</title>

	<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="/static/fonts/line-icons.css">
	<link href="/static/plugins/datatables/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
	<link href="/static/plugins/datatables/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
	<link href="/static/plugins/datatables/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="/static/css/main.css">
	<link rel="stylesheet" type="text/css" href="/static/css/responsive.css">

</head>
<body>
	<div class="app header-default side-nav-dark">
		<div class="layout">
			<!--顶部栏-->
			<div th:replace="~{/topbar::topbar}">
			</div>
			<!--侧边栏-->
			<div th:replace="~{/sidebar::sidebar}">
			</div>
			<!--主体部分-->
			<div class="page-container">

				<div class="main-content">
					<div class="container-fluid">

						<div class="breadcrumb-wrapper row">
							<div class="col-12 col-lg-3 col-md-6">
								<h4 class="page-title">合同信息一览表</h4>
							</div>
						</div>

					</div>
					<div class="container-fluid">
						<div class="row">
							<div class="col-md-10">
								<span class="badge badge-default">表单列表</span>
								<br>
								<br>
								<div class="text-right">
									<div class="btn-group" role="group">
										<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#addGrid">新增</button>
									</div>
								</div>
								<table id="datatable" class="table table-bordered ">
									<thead>
									<tr>
										<th>
											#
										</th>
										<th>
											合同名称
										</th>
										<th>
											合同编号
										</th>
										<th>
											负责人
										</th>
										<th>
											合同类别
										</th>
										<th>
											计划类别
										</th>
										<th>
											生效日期
										</th>
										<th>
											状态
										</th>
										<th>
											操作
										</th>
									</tr>
									</thead>
									<tbody>
									<tr th:each="insp:${conList}">
										<td th:text="${insp.getId()}">
											1
										</td>
										<td th:text="${insp.getName()}">
											高校科研创新服务平台
										</td>
										<td th:text="${insp.getCid()}">
											20190705
										</td>
										<td th:text="${insp.getLeader()}">
											张三
										</td>
										<td th:text="${insp.getcType()}">
											开发
										</td>
										<td th:text="${insp.getPlantype()}">
											国家、部门计划
										</td>
										<td th:text="${insp.getEffectiveDate()}">
											2019-07-07
										</td>
										<td th:text="${insp.getState()}"></td>
										<td>
											<a th:href="@{'/project/edit1?id='+${insp.getId()}}">
												<button type="button" class="btn btn-link">合同变更</button>
											</a>
										</td>
									</tr>
									</tbody>
								</table>
								<div class="modal fade" id="addGrid" tabindex="-1" role="dialog" aria-labelledby="Label" aria-hidden="true">
									<div class="modal-dialog" style="width:420px;" role="document">
										<div class="modal-content">
											<div class="modal-header px-4">
												<h5 class="modal-title" id="Label">Add Somthing to Grid</h5>
												<button type="button" class="close" data-dismiss="modal" aria-label="Close">
													<span class="material-icons ">close</span>
												</button>
											</div>
											<div class="modal-body p-4">

												<form id="inspForm" onsubmit="return f()" method="post">
													<div class="form-group">
														<label for="contract">选择要增加的项目合同</label>
														<select name="id" id="contract">
															<option th:each="contract:${projectList}" th:value="${contract.getId()}"
																	th:text="${contract.name}"></option>
														</select>
													</div>
													<div class="form-group">
														<label for="Input2">合同名称</label>
														<input type="text" class="form-control" id="Input2" name="name">
													</div>
													<div class="form-group">
														<label for="Input3">合同编号</label>
														<input type="text" class="form-control" id="Input3" name="cid">
													</div>
													<div class="form-group">
														<label for="Input4">负责人</label>
														<input type="text" class="form-control" id="Input4" name="leader">
													</div>
													<div class="form-group">
														<label for="Input5">合同类别</label>
														<select class="form-control" id="Input5" name="cType">
															<option>开发</option>
															<option>服务</option>
														</select>
													</div>
													<div class="form-group">
														<label for="Input6">计划类别</label>
														<select class="form-control" id="Input6" name="planType">
															<option>国家、部门计划</option>
															<option>地、市、县计划</option>
															<option>省、自治区、直辖市及计划单列市计划</option>
														</select>
													</div>
													<div class="form-group">
														<label for="Input7">生效日期</label>
														<input type="date" class="form-control" id="Input7" name="effectiveDate" >
													</div>
                                                    <div class="modal-footer px-4">
                                                        <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                                                        <button type="submit" class="btn btn-primary">提交</button>
                                                    </div>
												</form>

											</div>
										</div>
									</div>
								</div>
								<div class="modal fade" id="addGrid1" tabindex="-1" role="dialog" aria-labelledby="Label" aria-hidden="true">
									<div class="modal-dialog" style="width:420px;" role="document">
										<div class="modal-content">
											<div class="modal-header px-4">
												<h5 class="modal-title" id="Label1">Add Somthing to Grid</h5>
												<button type="button" class="close" data-dismiss="modal" aria-label="Close">
													<span class="material-icons ">close</span>
												</button>
											</div>
											<div class="modal-body p-4">

												<form>
													<div class="form-group">
														<label for="Input8">#</label>
														<input type="text" class="form-control" id="Input8" placeholder="1">
													</div>
													<div class="form-group">
														<label for="Input9">合同名称</label>
														<input type="text" class="form-control" id="Input9">
													</div>
													<div class="form-group">
														<label for="Input10">合同编号</label>
														<input type="text" class="form-control" id="Input10" >
													</div>
													<div class="form-group">
														<label for="Input11">负责人</label>
														<input type="text" class="form-control" id="Input11">
													</div>
													<div class="form-group">
														<label for="Input12">合同类别</label>
														<select class="form-control" id="Input12">
															<option>开发</option>
															<option>服务</option>
														</select>
													</div>
													<div class="form-group">
														<label for="Input13">计划类别</label>
														<select class="form-control" id="Input13">
															<option>国家、部门计划</option>
															<option>地、市、县计划</option>
															<option>省、自治区、直辖市及计划单列市计划</option>
														</select>
													</div>
													<div class="form-group">
														<label for="Input14">生效日期</label>
														<input type="date" class="form-control" id="Input14" >
													</div>
													<div class="modal-footer px-4">
														<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
														<button type="submit" class="btn btn-primary">确认</button>
													</div>
												</form>

											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>


					<footer class="content-footer">
						<div th:replace="~{/footer::footer}"></div>
					</footer>

				</div>

			</div>
		</div>
	</div>
	<script src="/static/js/jquery-min.js"></script>
	<script src="/static/js/popper.min.js"></script>
	<script src="/static/js/bootstrap.min.js"></script>
	<script src="/static/js/scripts.js"></script>
	<script src="/static/js/jquery.app.js"></script>
	<script src="/static/js/main.js"></script>

	<script src="/static/plugins/datatables/jquery.dataTables.min.js"></script>
	<script src="/static/plugins/datatables/dataTables.bootstrap4.min.js"></script>

	<script src="/static/plugins/datatables/dataTables.buttons.min.js"></script>
	<script src="/static/plugins/datatables/buttons.bootstrap4.min.js"></script>
	<script src="/static/plugins/datatables/jszip.min.js"></script>
	<script src="/static/plugins/datatables/pdfmake.min.js"></script>
	<script src="/static/plugins/datatables/vfs_fonts.js"></script>
	<script src="/static/plugins/datatables/buttons.html5.min.js"></script>
	<script src="/static/plugins/datatables/buttons.print.min.js"></script>
	<script src="/static/plugins/datatables/buttons.colVis.min.js"></script>

	<script src="/static/plugins/datatables/dataTables.responsive.min.js"></script>
	<script src="/static/plugins/datatables/responsive.bootstrap4.min.js"></script>

	<script src="/static/js/datatables.init.js"></script>
	
	<script type="text/javascript">
	// $('header navbar').load('/static/head.html',function(responseTxt,statusTxt,xhr){
     //        console.log('responseTxt,statusTxt,xhr');
	// 		}
	// )
	</script>

	<script type="text/javascript">
		function f() {
			var formData = new FormData($('#inspForm')[0]);
			$.ajax({
				url:"/project/addContract",
				type:"post",
				data:formData,
				processData:false,
				contentType:false,
				success:function (result) {
					if (result && result.success) {
						alert("提交成功");
						window.location.href = "/project/contract";
					} else {
						alert(result.msg);
					}
				}
			});
			return false;
		}
		</script>
	</body>
	</html>